//
//  LoginAndRegisterTitleView.m
//  ShowYork
//
//  Created by hxh on 2020/8/24.
//  Copyright © 2020 hxh. All rights reserved.
//

#import "LoginAndRegisterTitleView.h"

@interface LoginAndRegisterTitleView ()
@property (nonatomic,strong)UILabel *mainTitleLb;
@property (nonatomic,strong)UILabel *subTitleLb;
@end

@implementation LoginAndRegisterTitleView

- (instancetype)initWithMainTitle:(NSString *)mainTitle andSubTitle:(NSString *)subTitle{
    if (self = [super init]) {
        
        self.mainTitleLb = [[UILabel alloc]init];
        self.mainTitleLb.text = mainTitle;
        self.mainTitleLb.textColor = [UIColor whiteColor];
        self.mainTitleLb.font = [UIFont boldSystemFontOfSize:24];
        [self addSubview:self.mainTitleLb];
        
        self.subTitleLb = [[UILabel alloc]init];
        self.subTitleLb.text = subTitle;
        self.subTitleLb.textColor = RGBA(255, 255, 255, 0.5);
        self.subTitleLb.font = font(14);
        self.subTitleLb.numberOfLines = 0;
        [self addSubview:self.subTitleLb];
        
        [self.mainTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.right.equalTo(self);
        }];
        
        CGFloat margin = subTitle.length == 0?0:5;
    
        [self.subTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.mainTitleLb.mas_bottom).offset(margin);
            make.left.right.bottom.equalTo(self);
        }];
        
    }
    return self;
}
- (void)setMainColor:(UIColor *)mainColor{
    self.mainTitleLb.textColor = mainColor;
}
- (void)setSubColor:(UIColor *)subColor{
    self.subTitleLb.textColor = subColor;
}

@end
